package cn.laixueit.source.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.laixueit.source.mapper.DataDictMapper;
import cn.laixueit.source.po.TbDataDict;
import cn.laixueit.source.service.DataDictService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author duxiang
 * @date 2024/2/26 16:06
 */
@Service
public class DataDictServiceImpl extends ServiceImpl<DataDictMapper, TbDataDict> implements DataDictService {

    @Resource
    private DataDictMapper dataDictMapper;

    @Override
    public List<TbDataDict> findDataDictAndDetail(List<String> codes) {
//        return dataDictMapper.findDataDictAndDetail(codes);
        QueryWrapper<TbDataDict> wrapper = new QueryWrapper<>();
        wrapper.in(CollectionUtil.isNotEmpty(codes),"td.code",codes);
        wrapper.orderByAsc("_sort");
        return dataDictMapper.findDataDictAndDetail(wrapper);
    }
}
